package com.woniu.p2p.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.p2p.entity.New;
import com.woniu.p2p.mapper.NewMapper;
import com.woniu.p2p.service.NewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 86152
 * @create 2020/8/10
 * @since 1.0.0
 */
@Service
public class NewServiceImp implements NewService {
    @Autowired
    NewMapper newMapper;

    @Override
    public PageInfo<New> findnewlist(int start, int pagesize) {
        PageHelper.startPage(start,pagesize);
        List<New> news = newMapper.selectAll();
        PageInfo<New> newPageInfo = new PageInfo<>(news);
        return newPageInfo;
    }

    @Override
    public New getsinglenewbyid(Integer newId) {
        return newMapper.selectByPrimaryKey(newId);
    }
}
